import request from '@/utils/request';

const env = `trs_ymtc`;
// const env = `mock`;

export default {
  getTodoList(){
    // return request('trs_ymtc/user/viewUpdateForm.action?trsMastId=10753&format=json');
    return request(`${env}/user/toDo.action?&format=json`);
  },
  getProcessedList(){
    return request(`${env}/user/processed.action?&format=json`);
  },
  getApplicationList(){
    return request(`${env}/user/myApplications.action?&format=json`);
  },
  getDraftList(){
    return request(`${env}/user/myDraft.action?&format=json`);
  },
  getDetailData(params){
    const {action, query} = params;
    return request(`${env}/user/${action}.action?${query}&format=json`);
  },
  getSearchEmployee(data){
    return request(`${env}/exporthr/search.action?format=json&paginationSupport.startIndex=${data.index}&paginationSupport.countOnEachPage=${data.size}&orgId=${data.orgId}&keyWord=${data.keyword}`)
  },
  getOrgs(){
    return request(`${env}/exporthr/index.action?format=json`);
  },
  getApplicationInfo(){
    return request(`${env}/user/newRequest.action?format=json`);
  },
  saveApplication(data){
    return request(`${env}/user/createRequest.action?trsMast.companyCode=${data.companyCode}&trsMast.fabSite=${data.fabSite}&trsMast.isOneWay=${data.isOneWay}&trsMast.isOutboundTrip=${data.isOutboundTrip}&trsMast.formType=Travel+Request&format=json`);
  },
  saveDetailOfParams(data){
    const params = {
      path: `trs_ymtc/user/completeWorkflowEntry.action?format=json`,
      method: 'POST',
      body: data
    }
    return request(params);
  },
  saveDraftDetail(data){
    const params = {
      path: `trs_ymtc/user/saveDraft.action?format=json`,
      method: 'POST',
      body: data
    }
    return request(params);
  },
  getWbsCodes(data){
    const params = {
      path: `${env}/user/viewWbsCode.action?format=json`,
      method: 'POST',
      body: data
    }
    return request(params);
  },
  getCitys(){
    return request(`${env}/user/viewCity.action?format=json`);
  },
  saveAccommodationInfo(data){
    const params = {
      path: `${env}/user/saveAccommodationInfo.action?format=json`,
      method: 'POST',
      body: data
    }
    return request(params);
  },
  saveTicketInfo(data){
    const params = {
      path: `${env}/user/saveTicketInfo.action?format=json`,
      method: 'POST',
      body: data
    }
    return request(params);
  },
  saveReimbursementInfo(data){
    const params = {
      path: `${env}/user/saveReimbursementInfo.action?format=json`,
      method: 'POST',
      body: data
    }
    return request(params);
  },
  saveAdvanceInfo(data){
    const params = {
      path: `${env}/user/saveAdvanceInfo.action?format=json`,
      method: 'POST',
      body: data
    }
    return request(params);
  },
  getAddReimbursementInfoLabel(id){
    return request(`${env}/user/viewAddReimbursementInfo.action?${id}&format=json`);
  }
}
